﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.ChangeItem", ServerTypeId="{3e4716ac-a622-4d48-bc14-3fecabd52e21}")]
    public class ChangeItem : Change
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public ChangeItem(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "WebId"))
                {
                    if (str == "ListId")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ListId"] = reader.ReadGuid();
                        return flag;
                    }
                    if (str == "ItemId")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["ItemId"] = reader.ReadInt32();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["WebId"] = reader.ReadGuid();
            }
            return flag;
        }

        [Remote]
        public int ItemId
        {
            get
            {
                base.CheckUninitializedProperty("ItemId");
                return (int) base.ObjectData.Properties["ItemId"];
            }
        }

        [Remote]
        public Guid ListId
        {
            get
            {
                base.CheckUninitializedProperty("ListId");
                return (Guid) base.ObjectData.Properties["ListId"];
            }
        }

        [Remote]
        public Guid WebId
        {
            get
            {
                base.CheckUninitializedProperty("WebId");
                return (Guid) base.ObjectData.Properties["WebId"];
            }
        }
    }
}

